<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#import "/layout/select.ftl" as my/>
<#assign css>
<style>
</style>
</#assign>
<#assign js>
<script>
	function del(id) {
		layer.confirm('确定删除吗?', {icon: 3, title: '提示'}, function (index) {
			$.ajax({
				type: "POST",
				dataType: "json",
				url: "/category/delete/" + id,
				success: function (res) {
                    layer.msg(res.message, {time: 1000}, function () {
                        location.reload();
                    });

				}
			});
		});
	}
    function init() {
        layer.confirm('确定恢复平台默认物品品类设置，当前分站已经设置的物品品类信息将会被删除?', {icon: 7, title: '警告'}, function (index) {
            $.ajax({
                type: "GET",
                dataType: "json",
                url: "/category/init",
                success: function (res) {
                    layer.msg(res.message, {time: 1000}, function () {
                        location.reload();
                    });

                }
            });
        });
    }


	//tableId,queryId,conditionContainer
	//var userTable;
	var winId="userWin";
	$(function() {
		//init table and fill data
		//userTable = new CommonTable("user_table", "user_list", "searchDiv");

		//button event
		$('button[data-btn-type]').click(function() {
			var action = $(this).attr('data-btn-type');
			var rowId="ceshi";
			switch (action) {
				case 'add':
					modals.openWin({
						winId:winId,
						title:'新增物品品类,物品品类',
						width:'900px',
						url:"/categoryCfg/edit/ceshi"
					});
					break;
				case 'edit':
					if(!rowId){
						modals.info('请选择要编辑的行');
						return false;
					}
					modals.openWin({
						winId:winId,
						title:'编辑物品品类,物品品类【'+userTable.getSelectedRowData().name+'】',
						width:'900px',
						url:"/categoryCfg/edit/"+rowId,
					});
					break;
				case 'delete':
					if(!rowId){
						modals.info('请选择要删除的行');
						return false;
					}
					modals.confirm("是否要删除该行数据？",function(){
						ajaxPost(basePath+"/categoryCfg/delete/"+rowId,null,function(data){
							if(data.success){
								//modals.correct("已删除该数据");
								userTable.reloadRowData();
							}else{
								modals.error("物品品类,物品品类数据被引用，不可删除！");
							}
						});
					})
					break;
			}

		});
		//form_init();
	});
</script>
</#assign>
<@layout title="跑腿业务设置" active="category">
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        跑腿业务设置
    </h1>
    <ol class="breadcrumb">
        <li><a href="/"><i class="fa fa-home"></i> 管理后台</a></li>
        <li><a href="/categoryCfg/index"><i class="fa fa-list-ul"></i> 跑腿业务设置</a></li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <!-- Default box -->
    <div class="box box-primary">
        <div class="box-header">


        </div>
        <div class="box-body">
            <table class="table table-striped">
                <tr>
                    <th>编号</th>
                    <th>服务名称</th>
                    <th>配置</th>

                </tr>
                <tr>
                    <td >1</td>
                    <td >帮我送</td>

                    <td>
                    <@shiro.hasPermission name="system:category:edit">
                        <a class="btn btn-sm btn-primary" href="/category/index_category/1" data-btn-type="edit">物品品类</a>
					</@shiro.hasPermission>

                    </td>
                </tr>
                <tr>
                    <td >2</td>
                    <td >帮我取</td>

                    <td>
                    <@shiro.hasPermission name="system:category:edit">
                        <a class="btn btn-sm btn-primary" href="/category/index_category/2" data-btn-type="edit">物品品类</a>
					</@shiro.hasPermission>

                    </td>
                </tr>
                <tr>
                    <td >3</td>
                    <td >随意购</td>

                    <td>
                    <@shiro.hasPermission name="system:category:edit">
                        <a class="btn btn-sm btn-primary" href="/category/index_category/3" data-btn-type="edit">物品品类</a>
					</@shiro.hasPermission>

                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!-- /.box -->

</section>
<!-- /.content -->
</@layout>
